{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<script src="__PUBLIC__/admin/js/wangEditor.min.js"></script>
<section class="panel">
    {if isset($info)}
    <header class="panel-heading">
        <h4>添加商品下级分类</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" method="post" onsubmit="return false" role="form">
            <div class="form-group">
                <label class="col-sm-2 control-label">标题</label>

                <div class="col-sm-5">
                    <input type="text" value="" name="category_title" class="form-control"
                           placeholder="请输入标题">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">类型</label>

                <div class="col-sm-5">
                    <select name="category_id" class="form-control">
                        {foreach $cate as $item}
                        <option {if $info->category_id == $item->category_id}selected{/if} value="{$item->category_id}">{$item->category_title}</option>
                        {/foreach}
                    </select>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" data-url="{:url('admin/goodscategory/saveNextLevel',['id'=>$info->category_id])}"
                            onclick="main.ajaxPosts(this)" class="btn btn-primary">确定添加
                    </button>
                </div>
            </div>
        </form>
    </div>
    {/if}
</section>
{/block}


{block name="footer"}
    <script src="/admin/vendor/fuelux/radio.js"></script>
    <script>
        var E = window.wangEditor;
        var editor = new E('#editor');
        var $content = $('#content');
        editor.customConfig.uploadFileName = 'image'
        editor.customConfig.uploadImgServer = "{:url('upload/uploadEditor')}";
        editor.customConfig.onchange = function (html) {
            // 监控变化，同步更新到 textarea
            $content.val(html)
        };
        editor.customConfig.menus = [
            'head',  // 标题
            'bold',  // 粗体
            'fontSize',  // 字号
            'fontName',  // 字体
            'foreColor',  // 文字颜色
            'backColor',  // 背景颜色
            'link',  // 插入链接
            'list',  // 列表
            'justify',  // 对齐方式
            'quote',  // 引用
            'image',  // 插入图片
        ]
        editor.create()

        $(function(){
            $(".w-e-text-container").css('height','600px')
        })
    </script>
{/block}